#include<iostream>
using namespace std;
#include<vector>
#include<string>
#include<algorithm>
#include<stack>
class Solution {
public:
    bool pdnum(string& str) {
        if ((str[0] >= '0' && str[0] <= '9') || str.size() >= 2)
            return true;
        return false;
    }
    int evalRPN(vector<string>& tokens) {
        stack<int> sta;
        for (auto& e : tokens) {
            if (pdnum(e))
                sta.push(stoi(e));
            else {
                int now = sta.top();
                sta.pop();
                switch (e[0]) {
                case '+':now += sta.top(); break;
                case '-':now = sta.top() - now; break;
                case '*':now *= sta.top(); break;
                case '/':now = sta.top() / now; break;
                }
                sta.pop();
                sta.push(now);
            }
        }
        return sta.top();
    }
};